package com.lipaluma.field.validator.strategies;

/**
 * Strategies for testing length beside the threshold
 * @author mario.soares
 */
public enum LengthStrategy {
	GREATER_THAN {
		@Override
		public boolean validate(int threshold, int value) {
			return value > threshold;
		}
	}, GREATER_THAN_OR_EQUALS {
		@Override
		public boolean validate(int threshold, int value) {
			return value >= threshold;
		}
	}, LESS_THAN {
		@Override
		public boolean validate(int threshold, int value) {
			return value < threshold;
		}
	}, LESS_THAN_OR_EQUALS {
		@Override
		public boolean validate(int threshold, int value) {
			return value <= threshold;
		}
	}, EQUALS {
		@Override
		public boolean validate(int threshold, int value) {
			return value == threshold;
		}
	}, NOT_EQUALS {
		@Override
		public boolean validate(int threshold, int value) {
			return value != threshold;
		}
	};
	
	public abstract boolean validate(int threshold, int value);
}

